<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<h2>获取网易新闻</h2>
		<div id="myDiv">
			
		</div>
		<br>
		<button type="button" onclick="onAction();">获取</button>
		
		<h2>用户反馈</h2>
		<div id="myDiv1">
			
		</div>
		<br>
		<button type="button" onclick="onAction1();">获取</button>
	</body>
	<script type="text/javascript">
		function onAction(){
			var ajax = new XMLHttpRequest();
			ajax.open('POST','https://api.apiopen.top/getWangYiNews',true);
			ajax.setRequestHeader('Content-type','application/x-www-form-urlencoded')
			ajax.send('page=1&count=5');
			ajax.onreadystatechange = function(){
				if (ajax.readyState == 4 && ajax.status == 200) {
					var obj = JSON.parse(ajax.responseText);
					var px = '';
					for (var i = 0; i < obj.result.length; i++) {
						px += obj.result[i].path+'<br>';
						px += obj.result[i].image+'<br>';
						px += obj.result[i].title+'<br>';
						px += obj.result[i].passtime+'<br>'+'<br>';
					}
					console.log(obj.result[0])
					document.getElementById('myDiv').innerHTML = px;
					
				}
			}
			
		}
		function onAction1(){
			var ajax = new XMLHttpRequest();
			ajax.open('POST','https://api.apiopen.top/userFeedback',true);
			ajax.setRequestHeader('Content-type','application/x-www-form-urlencoded')
			ajax.send('apikey=9648872f9aa08da137ce45fe1dda8279&text=我觉得应该再增加个版本更新功能。&=135@qq.com');
			ajax.onreadystatechange = function(){
				if (ajax.readyState == 4 && ajax.status == 200) {
					var obj = JSON.parse(ajax.responseText);
					
					console.log(obj)
					document.getElementById('myDiv1').innerHTML = obj.message;
					
				}
			}
			
		}
	</script>
</html>
